<?php

class PartnerController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $req = $this->getRequest();
		if($req->isPost() && $req->isXMLHttpRequest()){
			$account = $req->getPost('account');
			$sex =  $req->getPost('sex');
			$idCartNum =  $req->getPost('idCartNum');
			$tel =  $req->getPost('tel');
			$partnerMethod = $req->getPost('partnerMethod');
			$money =  $req->getPost('money');
			$place = $req->getPost('place');
			
			if(empty($account) || empty($sex) || empty($tel) || $place==0){
				echo json_encode(array('msg'=>'fail'));
				exit;
			}
			$rest = new Application_Model_Rest();
			$data = array(
				'account'=>$account,
				'sex'=>$sex,
				'idCartNum'=>$idCartNum,
				'tel'=>$tel,
				'partnerMethod'=>$partnerMethod,
				'money'=>$money,
				'place'=>$place,
			);
			if($rest->postPartner($data)){
				echo json_encode(array('msg'=>'success'));
				exit;
			}else{
				echo json_encode(array('msg'=>'fail'));
				exit;
			}
			
		}
    }


}

